//
//  FQIFeedbackViewController.swift
//  YQInformation
//
//  Created by Max on 2017/11/6.
//  Copyright © 2017年 com.vector. All rights reserved.
//

import UIKit

class FQIFeedbackViewController: FQIViewController, UITextViewDelegate {

    @IBOutlet weak var oneButton: UIButton!
    @IBOutlet weak var twoButton: UIButton!
    @IBOutlet weak var threeButton: UIButton!
    
    @IBOutlet weak var textView: UITextView!
    
    @IBOutlet weak var suggestionLabel: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        self.title = "意见反馈"
        
        self.oneButton.setBackgroundImage(UIImage(named:"51"),for: .normal)
        self.twoButton.setBackgroundImage(UIImage(named:"51"),for: .normal)
        self.threeButton.setBackgroundImage(UIImage(named:"51"),for: .normal)
        self.oneButton.setBackgroundImage(UIImage(named:"50"),for: .selected)
        self.twoButton.setBackgroundImage(UIImage(named:"50"),for: .selected)
        self.threeButton.setBackgroundImage(UIImage(named:"50"),for: .selected)
        
       // self.automaticallyAdjustsScrollViewInsets = false
        
    }
    

    @IBAction func tellUsAction(_ sender: Any) {
        
        _ = self.navigationController?.popViewController(animated: true)
        
    }
 
    @IBAction func oneButtonAction(_ sender: UIButton) {
        
        
        if oneButton == sender{
            
        }else {
            
            self.oneButton.setBackgroundImage(UIImage(named:"51"),for: .normal)
            sender.setBackgroundImage(UIImage(named:"50"),for: .normal)
            
            
        }
        
        oneButton = sender
        
        if twoButton == sender{
            
        }else {
            
            self.twoButton.setBackgroundImage(UIImage(named:"51"),for: .normal)
            sender.setBackgroundImage(UIImage(named:"50"),for: .normal)
        }
        twoButton = sender
        
        if threeButton == sender{
            
        }else {
            
            self.threeButton.setBackgroundImage(UIImage(named:"51"),for: .normal)
            sender.setBackgroundImage(UIImage(named:"50"),for: .normal)
        }
        
        threeButton = sender
        
        
    }
    
    func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
        return true
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.view.endEditing(true)
    }
    
    func textViewDidChange(_ textView: UITextView) {
        suggestionLabel.isHidden = (textView.text.characters.count > 0)
    }
    
    func textViewDidEndEditing(_ textView: UITextView) {
        suggestionLabel.isHidden = (textView.text.characters.count > 0)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
}
